#include "RobotPara.h"
#include "tim.h"
#include "Encoder.h"

Encoder_Struct Encoder_s = {0,0,0,0};

void EncoderStart(TIM_HandleTypeDef *htim, uint32_t Channel)
{
	HAL_TIM_Encoder_Start(htim, Channel);
}

int16_t Get_Encoder(TIM_HandleTypeDef *htim)
{
	int16_t cnt;
	cnt = __HAL_TIM_GET_COUNTER(htim);
	__HAL_TIM_SET_COUNTER(htim, 0);
	return cnt;
}
